<script lang="ts">
import {defineComponent, reactive, ref, toRefs} from 'vue'
// code by AI
export default defineComponent({
  name: '404',

  setup() {
    const data = reactive({
      errorCode: '404',
      title: 'Page Not Found',
      message: 'The page you are looking for does not exist or has been moved.',
    })

    const methods = {
      goHome: () => {
        window.location.href = '/'
      }
    }

    const validators = {}
    const rules = reactive({})
    const refs = {}

    return {
      ...toRefs(data),
      ...methods,
      validators,
      rules,
      ...refs
    }
  }
})
</script>

<template>
  <div class="error-container">
    <div class="error-card">
      <div class="error-code">{{ errorCode }}</div>
      <h1 class="error-title">{{ title }}</h1>
      <p class="error-message">{{ message }}</p>
      <button class="btn-primary" @click="goHome">返回主页</button>
    </div>
  </div>
</template>

<style scoped>
.error-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  font-family: 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

.dark .error-container {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.error-card {
  text-align: center;
  max-width: 480px;
  padding: 40px 30px;
  border-radius: 16px;
  background: white;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  transform: translateY(0);
  animation: float 6s ease-in-out infinite;
}

.dark .error-card {
  background: #2d3748;
  color: white;
}

.error-code {
  font-size: 72px;
  font-weight: bold;
  color: #4f46e5;
  margin-bottom: 10px;
  line-height: 1;
}

.dark .error-code {
  color: #818cf8;
}

.error-title {
  font-size: 28px;
  margin: 10px 0;
  color: #1f2937;
}

.dark .error-title {
  color: #e2e8f0;
}

.error-message {
  color: #6b7280;
  margin-bottom: 30px;
  line-height: 1.6;
}

.dark .error-message {
  color: #cbd5e1;
}

.btn-primary {
  background-color: #4f46e5;
  color: white;
  border: none;
  padding: 12px 28px;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
  background-color: #4338ca;
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(79, 70, 229, 0.3);
}

.dark .btn-primary {
  background-color: #6366f1;
}

.dark .btn-primary:hover {
  background-color: #4f46e5;
}

@keyframes float {
  0% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
  100% {
    transform: translateY(0px);
  }
}

@media (max-width: 480px) {
  .error-container {
    padding: 20px;
  }

  .error-card {
    padding: 30px 20px;
  }

  .error-code {
    font-size: 60px;
  }

  .error-title {
    font-size: 24px;
  }
}
</style>